package com.example.fruitdemo.controller;

import com.example.fruitdemo.pojo.Address;
import com.example.fruitdemo.ruslet.R;
import com.example.fruitdemo.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/address")
public class AddressController {
   @Autowired
   private AddressService addressService;
    @GetMapping("/receive")
    public R<Address> getreceive(String authorization){
         return addressService.getByAuth(authorization);
    }
    @PostMapping("/subaddr")
    public R<Address> subAddress(@RequestBody Address address){
        System.out.println(address.getUserid());
        return addressService.subaddress(address);
    }
}
